define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem     : '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url      : 'system.system_admin/index',
        add_url        : 'system.system_admin/add',
        edit_url       : 'system.system_admin/edit',
        delete_url     : 'system.system_admin/delete',
        export_url     : 'system.system_admin/export',
        modify_url     : 'system.system_admin/modify'
    };

    return {
        index: function () {
            ea.table.render({
                init: init,
                cols: [
                    [
                        {type: 'checkbox'},
                        {field: 'id', title: 'id', search: false},
                        {field: 'auth_ids', title: '角色权限ID', search: false},
                        {field: 'head_img', title: '头像', search: false, templet: ea.table.image},
                        {field: 'username', title: '用户登录名', search: true},
                        {field: 'phone', title: '联系手机号', search: true},
                        {field: 'remark', title: '备注说明', search: false, templet: ea.table.text},
                        {field: 'login_num', title: '登录次数', search: false},
                        {field: 'sort', title: '排序', search: false, edit: 'text'},
                        {field        : 'status',
                            search    : 'select',
                            selectList: ["禁用", "启用"],
                            title     : '状态',
                            templet   : ea.table.switch
                        },
                        {field: 'create_time', title: '创建时间', minWidth: 80, search: 'range'},
                        {fixed: 'right', width: 250, title: '操作', templet: ea.table.tool}
                    ]
                ]
            });

            ea.listen();
        },
        add  : function () {
            ea.listen();
        },
        edit : function () {
            ea.listen();
        }
    };
});